# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python


class Recipe(recipe.Recipe):
    name = 'harfbuzz'
    version = '1.2.7'
    stype = SourceType.TARBALL
    url = 'http://www.freedesktop.org/software/harfbuzz/release/harfbuzz-%(version)s.tar.bz2'
    licenses = [License.LGPLv2Plus]
    deps = ['fontconfig', 'cairo', 'glib']
    platform_deps = {
        Platform.LINUX: ['icu'],
        Platform.ANDROID: ['icu'],
        Platform.WINDOWS: ['icu']
    }
    configure_options = '--enable-static --enable-glib --enable-gobject '
    patches = [name + '/fix-dll-revision.patch']

    files_bins = ['hb-ot-shape-closure', 'hb-view', 'hb-shape']
    files_libs = ['libharfbuzz']
    files_devel = ['include/harfbuzz/*.h', 'lib/pkgconfig/harfbuzz.pc']

    def prepare(self):
        if self.config.target_platform in [Platform.LINUX, Platform.ANDROID, Platform.WINDOWS]:
            self.configure_options += ' --with-icu '
            self.files_devel.append('lib/pkgconfig/harfbuzz-icu.pc')
            self.files_libs.append('libharfbuzz-icu')
        else:
            self.configure_options += ' --without-icu '
